const { log } = require('console');
const fs = require('fs');
const path = require('path');


async function test() {
    const fromFileName = path.relative(__dirname, "./myFile/img1.jpeg");
    const buffer = await fs.promises.readFile(fromFileName);
    const toFileName = path.resolve(__dirname, "./myFile/img2.jpeg");
    await fs.promises.writeFile(toFileName, buffer);
   
    log('copy file success')
}
test()